package algorithm.sort;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class Main {
    public static void main(String[] args) {
        List<Sort> sorts = new ArrayList<>();
        sorts.add(new QuickSort(ImplementType.DFS));
        // sorts.add(new MaxHeap());
        // sorts.add(new QuickSort(ImplementType.BFS));
        sorts.add(new SystemSort());
        // sorts.add(new Merge());
        // sorts.add(new BitMerge());
        sorts.add(new BitQuickSort());
        List<int[]> datas = new ArrayList<>();
        int start = 1000000;
        int times = 4;
        for (int i = 0; i < times; i++) {
            start = start << 1;
            int[] nums = SortUtil.generateNums(start);
            datas.add(nums);
        }

        Sort standard = new MaxHeap();
        for (Sort sort : sorts) {
            System.out.println("<<<<======================================================>>>>");
            System.out.println(String.format("sort method is %s", sort.getClass()));
            SortUtil.printIntArrays(SortUtil.example(sort, 10));
            System.out.println(String.format("this method is %s", SortUtil.checkIfRight(standard, sort, 100, 1000)));
            for (int i = 0; i < times; i++) {
                int[] orignals = datas.get(i);
                int[] tmpNums = Arrays.copyOf(orignals, orignals.length);
                SortUtil.evaluate(sort, tmpNums);
            }
            System.out.println("<<<<=======================================================>>>>");
        }
    }
}
